package com.woniu.main.goods.mapper;



import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import com.woniu.main.goods.pojo.Goods;
import com.woniu.main.goods.pojo.GoodsUnreviewed;

public interface GoodsAuditedMapper {
	//查询所有已被审核的物品
	@Select("select * from goods ")
	 @Results({
         @Result(column = "goods_id", property = "goods_id", jdbcType = JdbcType.INTEGER, id = true),
         @Result(column = "goods_state", property = "goods_state", jdbcType = JdbcType.INTEGER),
         @Result(column = "audit_create_time", property = "audit_create_time", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_city", property = "goods_city", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_desc", property = "goods_desc", jdbcType = JdbcType.DECIMAL),
         @Result(column = "goods_level", property = "goods_level", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_long_time", property = "goods_long_time", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_name", property = "goods_name", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_notice_time", property = "goods_notice_time", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_pic", property = "goods_pic", jdbcType = JdbcType.LONGVARCHAR),
         @Result(column = "goods_price", property = "goods_price", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_price_increase", property = "goods_price_increase", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_province", property = "goods_province", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_start_time", property = "goods_start_time", jdbcType = JdbcType.INTEGER),
         @Result(column = "goods_type_id", property = "goods_type_id", jdbcType = JdbcType.LONGVARCHAR)
 })
	public List<Goods> findAllAudited();

	
	//自动审核通过的商品添加到已审核通过商品表 
	@Insert("INSERT INTO goods (goods_name,goods_desc,goods_city,goods_level,goods_pic) VALUES "
			+ "(#{goods_name},#{goods_desc},#{goods_city},#{goods_level},#{goods_pic})")
	public void insertAudited(GoodsUnreviewed goodsUnreviewed);
	
}
